8f5c125a30aa9dff164915596ef09abcbed9b55e,opennms-dao/src/main/java/org/opennms/netmgt/config/C3P0ConnectionFactory.java,C3P0ConnectionFactory,C3P0ConnectionFactory,#String#,92
Before Change
private Database m_database;
public C3P0ConnectionFactory(String configFile) throws IOException, MarshalException, ValidationException, PropertyVetoException, SQLException {
Class dsc = Database.class;
// Set the system identifier for the source of the input stream.
// This is necessary so that any location information can
// positively identify the source of the error.
//
FileInputStream fileInputStream = new FileInputStream(configFile);
try {
InputSource dbIn = new InputSource(fileInputStream);
dbIn.setSystemId(configFile);
m_database = (Database) Unmarshaller.unmarshal(dsc, dbIn);
Param[] params = m_database.getDatabaseChoice().getDriver().getParam();
for (Iterator it = Arrays.asList(params).iterator(); it.hasNext();) {
Param param = (Param) it.next();
if (param.getName().equals("user")) {
m_user = param.getValue();
} else if (param.getName().equals("password")) {
m_password = param.getValue();
}
}
initializePool();
} finally {
fileInputStream.close();
}
After Change
// positively identify the source of the error.
//
FileInputStream fileInputStream = new FileInputStream(configFile);
final Reader rdr = new InputStreamReader(fileInputStream);
log().info("C3P2ConnectionFactory: setting up data sources from:"+configFile);
try {
JdbcDataSource ds = marshalDataSourceFromConfig(rdr, dsName);
initializePool(ds);
} finally {
rdr.close();
fileInputStream.close();